
package com.fary.beans.factory;

import com.fary.core.SpringException;
import com.fary.core.ResolvableType;

/**
 * BeanFactory是用于访问Spring Bean容器的根接口，是一个单纯的Bean工厂，也就是常说的IOC容器的顶层定义，各种IOC容器是在其基础上为了满足不同需求而扩展的，包括经常使用的ApplicationContext
 */
public interface BeanFactory {

	/**
	 *
	 */
	String FACTORY_BEAN_PREFIX = "&";


	/**
	 *
	 */
	Object getBean(String name) throws SpringException;

	/**
	 *
	 */
	<T> T getBean(String name, Class<T> requiredType) throws SpringException;

	/**
	 *
	 */
	Object getBean(String name, Object... args) throws SpringException;

	/**
	 *
	 */
	<T> T getBean(Class<T> requiredType) throws SpringException;

	/**
	 *
	 */
	<T> T getBean(Class<T> requiredType, Object... args) throws SpringException;


	/**
	 *
	 */
	boolean containsBean(String name);

	/**
	 *
	 */
	boolean isSingleton(String name) throws SpringException;

	/**
	 *
	 */
	boolean isPrototype(String name) throws SpringException;

	/**
	 *
	 */
	boolean isTypeMatch(String name, ResolvableType typeToMatch) throws SpringException;

	/**
	 *
	 */
	boolean isTypeMatch(String name, Class<?> typeToMatch) throws SpringException;

	/**
	 *
	 */
	Class<?> getType(String name) throws SpringException;

	/**
	 *
	 */
	String[] getAliases(String name);

}
